import { CHANGEMASTERTASKSACTIVATE, CHANGEMASTERTASKDATAACTIVATE } from "../constants";

const initState = {
    tasks: {
        task_data: [
            {
                key: 1,
                tasktitle: 'John Brown',
                bounty: 32,
                enddate: '2022-03-31',
                audit: ['0'],
                type_name: '人工智能',
                task_res: ['0'],
                email: '1123@qq.com',
                taskintro: '做后台',
                task_evi: 'xxxx'
            }
        ],
    },
    updateTask: {
        activate: false,
        id: "",
        tasktitle: "",
        taskintro: "",
        typeid: "", // 1、软件开发， 2、算法，3、人工智能， 4、大数据
        bounty: "",
        enddate: "",
        email: "",
        username: ""
    }
}

export default function TaskMasterManagePageReducer (preState = initState, action) {
    const { type, data } = action
    switch (type) {

        case CHANGEMASTERTASKSACTIVATE:
            return {
                ...preState,
                tasks: Object.assign({}, preState.tasks, data)
            }

        case CHANGEMASTERTASKDATAACTIVATE:
            return {
                ...preState,
                updateTask: Object.assign({}, preState.updateTask, data)
            }

        default:
            var state = preState
            return state
    }
}

